<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改密码</title> <#include "/WEB-INF/content/module-edit.html">
<script type="text/javascript"
	src="${request.contextPath}/res/core/sha256.js"></script>
<script type="text/javascript">
	function modify() {
		if (!$("#form").form('validate'))
			return;
		$("#_pwd").val(SHA256($("#pwd").val()));
		$("#_newpwd").val(SHA256($("#newpwd").val()));
		$("#_newpwds").val(SHA256($("#newpwds").val()));
		$("#form").ajaxSubmit({
			url : "update",
			success : function(data) {
				var msg = "修改失败";
				if (data.state) {
					if (data.info)
						msg = data.info;
					else
						msg = "修改成功";
					top.showMsg(msg);
					top.closeModule(moduleName, parentModuleName);
				} else {
					if (data.info)
						msg = data.info;
					top.showMsg(msg);
				}

			}
		});
	}
</script>
</head>
<body class="easyui-layout">
	<div region="north"
		style="background-color: #eee; padding: 5px; overflow: hidden;"
		border="false">
		<@auth code="sys:password:update"><a href="#"
			class="easyui-linkbutton" plain="true" iconCls="icon-add"
			style="border: 1px solid #ccc" onclick="javascript:modify()">保存</a>
		</@auth> 	<a href="#" class="easyui-linkbutton" plain="true"
			iconCls="icon-edit" style="border: 1px solid #ccc"
			onclick="javascript:cancel()">关闭</a>
	</div>
	<div region="center">
		<div id="p" class="easyui-panel"
			style="background: #fafafa; padding: 10px" fit="true"
			toolbar="#toolbar">
			<form id="form" method="post">
				<table class="form" cellspacing="0" style="width: 100%">
					<tbody style="border: 1px solid #ccc">
						<tr>
							<td class="label">当前账号：</td>
							<td><input readonly="readonly" value="${model.account!}">
							</td>
							<td class="validate"></td>
						</tr>
						<tr>
							<td class="label">原密码：</td>
							<td><input validType="length[3,32]"
								class="easyui-validatebox" required="true" type="password"
								id="pwd" value="" class="required" /> <input id="_pwd"
								name="pwd" type="hidden"></td>
							<td class="validate">*</td>
						</tr>
						<tr>
							<td class="label">新密码：</td>
							<td><input validType="length[3,32]"
								class="easyui-validatebox" required="true" type="password"
								id="newpwd" value="" class="required" /> <input id="_newpwd"
								type="hidden"></td>
							<td class="validate">*</td>
						</tr>
						<tr>
							<td class="label">确认新密码：</td>
							<td><input class="easyui-validatebox" required="true"
								type="password" id="newpwds" validType="equalTo['#newpwd']"
								invalidMessage="两次输入密码不匹配" value="" class="required" /> <input
								id="_newpwds" name="newPwd" type="hidden"></td>
							<td class="validate">*</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</body>
</html>